<?php
JunctionFileCabinet::using("Junction_Db_Creole_Adapter");
JunctionFileCabinet::using("Test_Database_Catalog");

/**
 * Series of tests for the adapter.  Note that these won't work unless
 * the database being connected to really exists.  By default only the
 * SQLite database will exist (as it is included in the source code).
 */
class Test_Junction_Db_Creole_Adapter extends UnitTestCase {
	
//	public function testMySQL() {
//		try {
//			$driver = "mysql";
//			$host = "localhost";
//			$database = "JunctionTest";
//			$user = "JunctionUser";
//			$password = "junction";
//			
//			$adapter = new Junction_Db_Creole_Adapter($driver,
//				$host,
//				$database,
//				$user,
//				$password);
//				
//			$dao = $adapter->getDao();
//			$this->pass();
//		} catch (Junction_Db_Common_Exception $e) {
//			$this->fail();
//		}
//		
//		try {
//			$adapter = new Junction_Db_Creole_Adapter($driver,
//				$host,
//				"NotADatabase",
//				$user,
//				$password);
//			$this->fail();
//		} catch (Junction_Db_Common_Exception $e) {
//			$this->pass();
//		} catch (Exception $e) {
//			$this->fail();
//		}
//	}
	
	public function testSqlite() {
		try {
			$driver = "sqlite";
			$host = null;
			$database = Test_Database_Catalog::fetch("test.sdb");
			$user = null;
			$password = null;
			
			$adapter = new Junction_Db_Creole_Adapter($driver,
				$host,
				$database,
				$user,
				$password);
				
			$dao = $adapter->getDao();
			$this->pass();
			
		} catch (Junction_Db_Common_Exception $e) {
			$this->fail();
		}
	}
}
?>